﻿@using System.Diagnostics

@using Super.Infrastructure
@{
    Layout = null;

    var controller = (string)ViewContext.RouteData.Values["controller"];
    var action = (string)ViewContext.RouteData.Values["action"];
    var temp = (string)ViewContext.RouteData.Values["id"];

    var id = temp.ToInt(0);

    var groupList = CacheService.GetShopCategory();
    var TopNavs = groupList.Where(a => a.IsTop).OrderBy(a => a.TopIndex).ToList();
    var currentCategory = groupList.FirstOrDefault(a => a.ID == id);


    var userId = SuperService.LoginUser.UserID;
    var loginUser = SuperService.LoginUser.User;
    var adp = new DbContextAdapter();
    var _userService = new UserService(adp);
    var messageService = new MessageService(adp);
        
    var topicCategory = CacheService.GetForumCategory().Where(a => a.IsTop).OrderBy(a => a.TopIndex).ToList();
    var nowCategoryId = Query.Get("c").ToInt(0);

    
    
}
<div class="header mb10">
    <div class="h_con mc">
        <a href="/home/" class="logo"></a>
        <!--/logo-->
        <div class="call">
            VIP服务热线：0519-88059938</div>
        <!--/call-->
        <div style="height: 20px; width: 100px; position: absolute; top: 5px; right: 330px;">
             <iframe width="136" height="24" frameborder="0" allowtransparency="true" marginwidth="0" marginheight="0" scrolling="no" border="0" src="http://widget.weibo.com/relationship/followbutton.php?language=zh_cn&width=136&height=24&uid=2534467204&style=2&btn=red&dpc=1"></iframe>
        </div>
        <div class="nav_cl">
            <a href="/home" class="sy">首页</a><a href="/topic" class="lt">论坛</a></div>
        <!--/nav_cl-->
        @{
            if (userId > 0)
            {
            <div class="login_01">
                <table border="0">
                    <tr>
                        <td width="23">
                            <img src="@_userService.GetAvatarUrl(loginUser,AvatarSizeEnum.Small)" width="24" height="24" /></td>
                        <td>
                            <a href="/usercenter">
                                <b class="c_blue_2" >@loginUser.UserName</b>
                            </a>，欢迎您！
                            积分（<b class="c_red">@loginUser.Integral</b>）站内信（<a href="/usercenter/message">
                                                                                <b class="c_green">@messageService.GetUserUnReadMessage(loginUser.ID) </b>
                                                                            </a>）<a href="/Login?a=out">退出</a>
                        </td>
                    </tr>
                </table>
            </div>

            }
            else
            {
            <div class="login">
                <a href="/login" class="login_l">登录</a><a href="/register" class="login_r">注册</a>
            </div>
  
            }
        }
    </div>
    <!--/h_con-->
    @{
        if (controller.ToUpper() == "HOME" || controller.ToUpper() == "SHOPLIST")
        {
        <div class="nav">
            @{
            foreach (var category in TopNavs)
            {
                if (category.ID == id || (currentCategory != null && currentCategory.ParentId == category.ID))
                {
                <a class="nav_on" href="/shoplist/@category.ID">@category.Name</a>
                }
                else
                {
                <a href="/shoplist/@category.ID">@category.Name</a>
     
                }

            }
            }
        </div>
        }

        if (controller.ToUpper() == "TOPIC")
        {
            <div class="nav_01">
                @{
                foreach (var category in topicCategory)
                {
                    if (category.ID == nowCategoryId)
                    {
                    <a href="/topic?c=@category.ID#TopicNav" class="nav_01_on">@category.Name</a>
                    }
                    else
                    {
                    <a href="/topic?c=@category.ID#TopicNav" >@category.Name</a>
                    }

                }
                }
            </div>
        }
    }
    <!--/nav-->
</div>
<!--/头部-->
